<?php
$page = 'Schema';
$in_site = 'dassnfu';
$loginVereist = 1;
include($_SERVER['DOCUMENT_ROOT']."/start.php");

$bestanden = "<link rel='stylesheet' type='text/css' href='/bestanden/css/style_tabellen".$style_nmr.".css' />
<link rel='stylesheet' type='text/css' href='/bestanden/js/qtip/css/jquery.qtip".$style_nmr.".css' />
<script type='text/javascript' src='/bestanden/js/qtip/js/jquery.qtip.min.js'></script>
<script type='text/javascript' src='/bestanden/js/qtip/js/standard_initialize.js'></script>";

include_once($_SERVER['DOCUMENT_ROOT']."/php_functions/database_connectie.php");
//bb-parser
include_once($_SERVER['DOCUMENT_ROOT']."/php_functions/nbbc_parser/initialize_nbbc.php");

include_once($_SERVER['DOCUMENT_ROOT']."/php_functions/dag_maand.php");
include_once($_SERVER['DOCUMENT_ROOT']."/php_functions/wedstrijd_functies.php");
include_once($_SERVER['DOCUMENT_ROOT']."/php_functions/instellingen.php");
include_once($_SERVER['DOCUMENT_ROOT']."/php_functions/my_query.php");
include_once($_SERVER['DOCUMENT_ROOT']."/header.php");
include_once($_SERVER['DOCUMENT_ROOT']."/sidebar.php");

echo $mainClass->showPageStart();

$alles_goed = true;
if($alles_goed == true) {
	$myQuery->tabel = "Wedstrijd";
	$myQuery->distinct = "Wedstrijd.wedstrijdId";
	$myQuery->alleTabelAttributen = true;
	$myQuery->spelerId = $spelerId;
	$myQuery->uniekeId = $_GET['id'];
	$myQuery->controleerTeam = true;
	$myQuery->informatie = true;
	$myQuery->orderBy = "Wedstrijd.datum";
	$myQuery->makeSelectQuery(true);

	if($myQuery->isValidResult()) {
		/* De tabel wordt aangemaakt */
		$row = $myQuery->fetchRow();
		echo "<span class='button'><a href='/schema/?id=".$_GET['id']."'><span class='icon_font'>&#x42;</span>&nbsp;&nbsp;Terug</a></span>";
		
		echo "<div class='clear'></div>";
		
		echo "<div class='list big_font mid_width'>";
		echo "<div class='content'>";
		echo "<table class='list'>";
			echo "<tr>";
				echo "<td>";
					echo "Datum</td>";
				echo "<td>";
					echo getDagWeekString(date('w', strtotime($row['datum'])), false).", ".date('j', strtotime($row['datum']))." ".getMaandString(date('m', strtotime($row['datum'])), false)."</td>";
			echo "</tr>";
			echo "<tr>";
				echo "<td>";
					echo "Verzameltijd</td>";
				echo "<td>";
					echo ($row['verzameltijd'] <> "00:00:00" ? date('H:i', strtotime($row['verzameltijd']))." uur" : "-")."</td>";
			echo "</tr>";
			echo "<tr>";
				echo "<td>";
					echo "Starttijd wedstrijd</td>";
				echo "<td>";
					echo date('H:i', strtotime($row['datum']))." uur</td>";
			echo "</tr>";
			echo "<tr>";
				echo "<td>";
					echo "Tegenstander</td>";
				echo "<td>";
					echo $row['tegenstander']."</td>";
			echo "</tr>";
			echo "<tr>";
				echo "<td>";
					echo "Waar</td>";
				echo "<td>";
					echo (empty($row['waar']) ? "Uit" : "Thuis")."</td>";
			echo "</tr>";
			echo "<tr>";
				echo "<td>";
					echo "Uitslag</td>";
				echo "<td".($row['thuisscore'] < 99 && $row['uitscore'] < 99 ? ($row['thuisscore'] == $row['uitscore'] ? " class='gelijk'" : ((!empty($row['waar']) && $row['thuisscore'] > $row['uitscore']) || (empty($row['waar']) && $row['thuisscore'] < $row['uitscore']) ? " class='gewonnen'" : " class='verloren'")) : "").">";
					echo ($row['thuisscore'] < 99 && $row['uitscore'] < 99 ? $row['thuisscore']." - ".$row['uitscore'] : "-")."</td>";
			echo "</tr>";
			/* LEGE RIJ -------------- */
			echo "<tr><td colspan='2'>&nbsp;</td></tr>";
			echo "<tr>";
				echo "<td>";
					echo "Code</td>";
				echo "<td>";
					echo (empty($row['wedstrijdcode']) ? "-" : $row['wedstrijdcode'])."</td>";
			echo "</tr>";
			echo "<tr>";
				echo "<td>";
					echo "Oefenwedstrijd</td>";
				echo "<td class='icon_font'>";
					echo (empty($row['oefenwedstrijd']) ? "&#x46;" : "&#x44;")."</td>";
			echo "</tr>";
			echo "<tr>";
				echo "<td>";
					echo "Wedstrijd status</td>";
				echo "<td>";
					echo "<span class='icon_font'>".(empty($row['afgelast']) && empty($row['verregend']) ? "&#x44;</span>&nbsp;&nbsp;(geen bijzonderheden)" : (empty($row['verregend']) ? "&#x3b;</span>&nbsp;&nbsp;(afgelasting)" : "&#x40;</span>&nbsp;&nbsp;(verregend)"))."</td>";
			echo "</tr>";
		echo "</table>";
		echo "</div></div>";
		
		echo "<div class='clear'></div>";
		
		if(isset($row['bericht'])) {
			if(empty($row['symbool'])) {
				$mainClass->addInformation($bbcode->Parse($row['bericht']));
				echo $mainClass->showInformations();
			}else {
				$mainClass->addError($bbcode->Parse($row['bericht']));
				echo $mainClass->showErrors();
			}
		}
	}else {
		$mainClass->addError("Het ophalen van de wedstrijden is mislukt.");
		echo $mainClass->showErrors();
	}
}
echo $mainClass->showPageEnd();
include_once($_SERVER['DOCUMENT_ROOT']."/footer.php");
?>
